<h1>{{#if user.id}}编辑用户{{else}}添加用户{{/if}}</h1>
<form action="/admin/users{{#if user.id}}/{{user.id}}{{/if}}" method="post">
  <!--  这个隐藏域代表是更新操作：写一个中间件-->
  {{#if user.id}}<input type="hidden" name="_method" value="PUT">{{/if}}
  <div class="mb-3">
    <label for="username" class="form-label">用户名</label>
    <input type="text" class="form-control" name="username" id="username" value="{{user.username}}">
  </div>
  <div class="mb-3">
    <label for="password" class="form-label">密码</label>
    <input type="password" class="form-control" name="password" id="password" value="">
  </div>
  <div class="mb-3">
    <label for="email" class="form-label">邮箱</label>
    <input type="email" class="form-control" name="email" id="email" value="{{user.email}}">
  </div>
  <div class="mb-3">
    <label for="status" class="form-label">状态</label>
    <select class="form-control" name="status" id="status">
      <option value="1" {{#if user.status}}selected{{/if}}>启用</option>
      <option value="0" {{#unless user.status}}selected{{/unless}}>禁用</option>
    </select>
  </div>
  <button type="submit" class="btn btn-primary">提交</button>
</form>